package com.seven.controller;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.Objects;

/**
 * @author WenJieYin
 **/
@RestController
@RequestMapping("/test")
public class TestController {

    @PostMapping("post")
    public String post(MultipartFile file1, MultipartFile file2, MultipartFile file3, MultipartFile file4) {
        if (Objects.nonNull(file1) && !file1.isEmpty()) {
            System.out.println("======>" + file1.getOriginalFilename());
            System.out.println("======>" + file1.getSize());
        }
        if (Objects.nonNull(file2) && !file2.isEmpty()) {
            System.out.println("======>" + file2.getOriginalFilename());
            System.out.println("======>" + file2.getSize());
        }
        if (Objects.nonNull(file3) && !file3.isEmpty()) {
            System.out.println("======>" + file3.getOriginalFilename());
            System.out.println("======>" + file3.getSize());
        }
        if (Objects.nonNull(file4) && !file4.isEmpty()) {
            System.out.println("======>" + file4.getOriginalFilename());
            System.out.println("======>" + file4.getSize());
        }
        System.out.println("======>test");
        return "test";
    }
}
